import numpy as np
from sklearn.preprocessing import StandardScaler


class Normalize:
    def __init__(self) -> None:

        self.scaler = StandardScaler()

    def __call__(self, sample):

        einthoven_data = sample[:3]
        goldberger_data = sample[3:6]
        wilson_data = sample[6:]

        normalized_einthoven = self.scaler.fit_transform(einthoven_data)
        normalized_goldberger = self.scaler.fit_transform(goldberger_data)
        normalized_wilson = self.scaler.fit_transform(wilson_data)

        normalized = np.concatenate([normalized_einthoven, normalized_goldberger, normalized_wilson], axis=0)

        return normalized